# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=ocaml-hashcons
pkgver=1.3
pkgrel=6
pkgdesc='OCaml hash-consing library'
url="https://github.com/backtracking/ocaml-hashcons"
arch=('loong64' 'x86_64')
license=('LGPL2.1')
depends=('ocaml>=5.0.0')
makedepends=('ocaml-findlib')
options=('!strip' '!makeflags' 'staticlibs')
source=("https://github.com/backtracking/ocaml-hashcons/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('59c72966f48ea67c694dd49099eca180b52d3da81d4300172ace6edb4a5d72ce')

prepare() {
  cd $pkgname-$pkgver
  # Our destdir won't have it installed. Calling ocamlfind remove fails due to a syntax error
  sed -i '/remove/d' Makefile.in

  autoconf
}

build() {
  cd $pkgname-$pkgver
  ./configure
  make all opt
}

package() {
  cd $pkgname-$pkgver
  mkdir -p $pkgdir/usr/lib/ocaml
  make DESTDIR="-destdir $pkgdir/usr/lib/ocaml" install
}
